<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var data={};
        function a(){
            //只要调用或更改了name的值就会执行get，和set
            Object.defineProperty(data,"name",{
                get(){
                    console.log("被调用");
                    return 1;
                },
                set(){}
            });
        }
        a();
        </script>
</head>
<body>
    
</body>
</html>